<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>结算记录-{$webname}</title>
    {Model_Supplier::css("style.css,base.css,extend.css",'brokerage')}
    {Common::js("jquery.min.js")}
    <script src="/plugins/supplier_brokerage/public/js/laydate/laydate.js"></script>
    <link type="text/css" href="/supplier/public/pc/css/supplier_back.css" rel="stylesheet"/>
</head>
<body>
<div class="supplier-main-block">
    <div class="content-box">
        <div class="frame-box">
            <div class="finance-content">
                <div class="finance-bloock">
                    <div class="census-item census-item-float-left">
                        <ul>
                            <li class="clearfix">
                                <strong class="item-bt">收款时间：</strong>
                                <div class="item-nr">
                                    <input class="date-start" type="text" id="stattime" value="{$stattime}" style="padding-left: 5px">
                                </div>
                            </li>
                            <li class="clearfix">
                                <div class="item-nr">
                                    <input class="date-start" type="text" id="endtime" value="{$endtime}" style="padding-left: 5px">
                                </div>
                            </li>
                            <li class="clearfix">
                                <strong class="item-bt">结算状态：</strong>
                                <div class="item-nr">
                                    <select class="attr-select" id="status" style="padding-left: 5px">
                                        <option value="0">全部</option>
                                        <option value="1" {if $status==1}selected{/if}>未结算</option>
                                        <option value="2" {if $status==2}selected{/if}>已结算</option>
                                    </select>
                                </div>
                            </li>
                            <li class="clearfix">
                                <strong class="item-bt">产品类型：</strong>
                                <div class="item-nr">
                                    <select class="attr-select" id="type" style="padding-left: 5px">
                                        <option value="0">全部</option>
                                        {loop $apply_product $p}
                                        <option value="{$p['id']}" {if $type==$p['id']}selected{/if}>
                                            {$p['modulename']}
                                        </option>
                                        {/loop}
                                    </select>
                                </div>
                            </li>
                            <li class="clearfix">
                                <strong class="item-bt">渠道列表：</strong>
                                <div class="item-nr">
                                    <select class="attr-select" id="channel" style="padding-left: 5px">
                                        {loop $channel $c}
                                        <option value="{$c['id']}" {if $c['selected']==1}selected{/if}>{$c['title']}</option>
                                        {/loop}
                                    </select>
                                </div>
                            </li>
                            <li class="clearfix">
                                <strong class="item-bt">产品名称：</strong>
                                <div class="item-nr">
                                    <input type="text" class="date-start " value="{$keyword}" id="keyword" style="padding-left: 5px;width: 200px" placeholder="产品名称">
                                </div>
                            </li>
                            <li class="clearfix">
                                <div class="item-nr">
                                    <a href="javascript:;" class="choose-btn " id="search-btn">搜索</a>
                                </div>
                            </li>
                            <li class="clearfix" style="float: right">
                                <div class="item-nr">
                                    <a href="javascript:;" class="choose-btn" id="excel-btn">导出Excel</a>
                                    <a href="javascript:;" class="choose-btn" onclick="window.location.reload()">刷新</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="cw-table clearfix">
                        {if !empty($list)}
                        <table width="100%" border="0">
                            <thead>
                            <tr id="record_list_header">
                                <th width="10%">订单号</th>
                                <th width="50%">产品名称</th>
                                <th width="10%">收款时间</th>
                                <th width="5%">订单状态</th>
                                <th width="5%">应结金额</th>
                                <th width="5%">未结金额</th>
                                <th width="5%">已结金额</th>
                                <th width="10%">结算状态</th>
                            </tr>
                            </thead>
                            <tbody>
                            {loop $list $l}
                            <tr style="height:65px">
                                <td>{$l['ordersn']}</td>
                                <td>{$l['productname']}</td>
                                <td>{$l['addtime']}</td>
                                <td>
                                    {if $l['order_status']==2}
                                    待消费
                                    {elseif $l['order_status']==4}
                                    已退款
                                    {elseif $l['order_status']==6}
                                    退款中{else}已完成
                                    {/if}
                                </td>
                                <td>
                                    {$l['brokerage']}
                                    {if $l['dingjin']>0&&$l['paytype']==2}
                                    (定金:{$l['dingjin']})
                                    {/if}
                                </td>
                                <td>
                                    {if $l['open_price']}
                                    <span style="color: red">{$l['open_price']}</span>
                                    {else}
                                    0
                                    {/if}
                                </td>
                                <td>{$l['finish_brokerage']}</td>
                                <td>
                                    {if $l['status']==1 && ($l['order_status']==2 || $l['order_status']==5)}
                                    <span style="color: red">未结算</span>
                                    {elseif $l['status']==1 && $l['order_status']==4}
                                    <span style="color: red">订单已退款不可结算</span>
                                    {elseif $l['status']==1 && $l['order_status']==6}
                                    <span style="color: red">客户申请退款中不可结算</span>
                                    {elseif $l['status']==1 && $l['order_status']==3}
                                    <span style="color: red">订单已关闭不可结算</span>
                                    {elseif $l['status']==2}
                                    <span style="color: #14cc5c">已结算</span>
                                    {/if}
                                </td>
                            </tr>
                            {/loop}
                            </tbody>
                        </table>
                        {else}
                        <div style="text-align: center;height: 40px;line-height: 40px;display: inherit;" hidden>
                            当前渠道还没有产生收益!
                        </div>
                        {/if}
                    </div>
                    <div class="view-block-table">
                        {$pageinfo}
                    </div>
                </div>
            </div><!-- 财务总览 -->
        </div>

    </div>
</div>
</body>
<script>
    $(function () {
        $('.hd-menu a').removeClass('cur');
        $('.hd-menu #brokerage').addClass('cur');
        $('#brokerage_index').addClass('on');

        $('#search-btn').click(function () {
            var status = $('#status').val();
            var keyword = $('#keyword').val();
            var stattime = $('#stattime').val();
            var endtime = $('#endtime').val();
            var type = $('#type').val();
            var channel_id = $('#channel').val();
            var url = '{$cmsurl}supplier_brokerage/index?status=' + status + '&keyword=' + keyword + '&stattime=' + stattime + '&endtime=' + endtime + '&type=' + type + '&channel_id=' + channel_id;
            location.href = url;
        })

        //导出EXcel
        $("#excel-btn").click(function () {
            var status = $('#status').val();
            var keyword = $('#keyword').val();
            var stattime = $('#stattime').val();
            var endtime = $('#endtime').val();
            var type = $('#type').val();
            var channel_id = $('#channel').val();
            var url = '{$cmsurl}supplier_brokerage/ajax_excel_brokerage?status=' + status + '&keyword=' + keyword + '&stattime=' + stattime + '&endtime=' + endtime + '&type=' + type + '&channel_id=' + channel_id;
            window.open(url);
        })

        laydate.render({
            elem: '#stattime' //指定元素
        });
        laydate.render({
            elem: '#endtime' //指定元素
        });
    })
</script>
</html>

